package com.msb.controller;

import com.sun.org.glassfish.gmbal.ParameterNames;
import jdk.nashorn.internal.runtime.RewriteException;
import org.springframework.web.bind.annotation.*;

/**
 * @author sunpeng
 * @Date 2021-06-01 17:40
 */

@RestController //@Controller + @ResponseBody
public class RestTypeController {

    //http://localhost:8090/springmvc_first_war_exploded/rest/params/sunpeng/20：所有参数必传
    @GetMapping("/restParams/{name}/{id}")
    private String params(@PathVariable("id") int myId, String name){
        System.out.println("name:"+name+"id:"+myId);
        return "success";
    }

    @GetMapping("/restTest")
    private String get(){
        System.out.println("get");
        return "get";
    }

    @PostMapping("/restTest")
    private String post(){
        System.out.println("post");
        return "post";
    }

    @PutMapping("/restTest")
    private String put(){
        System.out.println("put");
        return "put";
    }

    @DeleteMapping("/restTest")
    private String delete(){
        System.out.println("delete");
        return "delete";
    }

}
